package cn.edu.abtu.mapper;

import cn.edu.abtu.entity.SysRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

/**
 * (SysRole)表数据库访问层
 *
 * @author makejava
 * @since 2022-11-16 11:48:23
 */
@Repository
public interface SysRoleMapper extends BaseMapper<SysRole> {

    @Select("select count(1) from sys_user_role where role_id = #{id}")
    int getRoleCountByRoleId(Long id);

    @Delete("delete from sys_role_permission where role_id = #{id}")
    int deleteRolePermissionByRoleId(Long id);

    public boolean saveRolePermission(Long roleId, List<Long> permissionIds);
}

